<?php
class RecuperoController extends AppController {
    var $name = null; // riferimento alla cartella delle view
    //var $modelClass = 'Multa';
    
    public function beforeFilter(){
    	
		parent::beforeFilter();
		$this->Auth->allow('slugTournament','slugTeam','slugMatch');

    }

    public function index() {

    }
	
    public function slugTournament() {
    	$this->loadModel('Tournament');
		$records=$this->Tournament->find("all",array("recursive"=>-1, "fields"=>array("Tournament.id")));
		// pr($jobbers);die;
		foreach ($records as $record) {
			$this->Tournament->recursive=-1;
			$this->Tournament->read(null,$record["Tournament"]["id"]);
			$this->Tournament->save();
		}
		$this->Session->setFlash("Recupero eseguito.");
		$this->redirect("/Bookmakers/index");
    }

    public function slugTeam() {
    	$this->loadModel('Team');
		$records=$this->Team->find("all",array("recursive"=>-1, "fields"=>array("Team.id")));
		// pr($jobbers);die;
		foreach ($records as $record) {
			$this->Team->recursive=-1;
			$this->Team->read(null,$record["Team"]["id"]);
			$this->Team->save();
		}
		$this->Session->setFlash("Recupero eseguito.");
		$this->redirect("/Bookmakers/index");
    }
	
    public function slugMatch() {
    	$this->loadModel('Match');
		$records=$this->Match->find("all",array("recursive"=>-1, "fields"=>array("Match.id")));
		// pr($jobbers);die;
		foreach ($records as $record) {
			$this->Match->recursive=-1;
			$this->Match->read(null,$record["Match"]["id"]);
			$this->Match->save();
		}
		$this->Session->setFlash("Recupero eseguito.");
		$this->redirect("/Bookmakers/index");
    }

}
?>